/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef __LIB3D_HARD_DIRECTX8_RENDERTARGET_H__
#define __LIB3D_HARD_DIRECTX8_RENDERTARGET_H__

#include <lib3d/hard/RenderTarget.h>
#include "Dependent.h"
#include <d3d9.h>

namespace liba
{
namespace lib3d
{
namespace hard
{
namespace directx8
{
class Hardware;

class RenderTarget :
	public hard::RenderTarget,
	public Dependent,
	public hard::TextureBase
{
protected:
	IDirect3DTexture9 * texture;
	bool valid_flag;
	D3DLOCKED_RECT locked_rect;
public:
	RenderTarget(Hardware * hardware, const Atom & name, int width, int height);
	virtual ~RenderTarget();

	virtual bool start_scene(double left, double right, double top, double bottom);
	virtual const int get_width()const;
	virtual const int get_height()const;

	virtual void invalidate();
	virtual void release();

	virtual bool is_valid();
	virtual bool set_in_hardware(int stage);
	virtual void get_data();
};


} // namespace directx8
} // namespace hard
} // namespace lib3d
} // namespace liba
using namespace liba;

#endif //__LIB3D_HARD_DIRECTX8_RENDERTARGET_H__